//
//  MYRequesTool+user.m
//  JQLive
//
//  Created by Bruce on 2020/8/10.
//  Copyright © 2020 mlkq. All rights reserved.
//

#import "MYRequesTool+user.h"

@implementation MYRequesTool (user)

#pragma mark -- APP-用户服务 post

/// 获取短信验证码 MY_user_getCaptchaSms
/// @param param mobile 手机号码 smsType 短信类型(1: 身份验证, 2: 登录, 3: 异地登录, 4: 注册, 5: 修改密码, 6: 变更重要信息 7:找回密码)
/// @param successHandle 成功回调
/// @param failureHandle 失败回调
+ (void)MY_user_getCaptchaSms_RequestWithParam:(NSDictionary *)param
                                       successHandle:(void(^)(id response))successHandle
                                       failureHandle:(void(^)(NSError *error))failureHandle{

    [MYHTTPManager  postAFNWithUrl:MY_user_getCaptchaSms parameters:param MYServiceModuleType:PublicBaseUrl_Type successHandle:^(NSURLSessionTask * _Nonnull task, id  _Nonnull response) {
        DLog(@"%@",response);

        if ([self requestReslutDelWith:response]) {
            if (successHandle) {
                successHandle(response);
            }
        }
        else
        {
            if (failureHandle) {
                failureHandle(nil);
            }
        }
        
        
    } failureHandle:^(NSURLSessionTask * _Nonnull task, NSError * _Nonnull error) {
        DLog(@"%@",error);

        if (failureHandle) {
            failureHandle(error);
        }
    }];
}
/// 一键登录 MY_user_loginForOneClick
/// @param param accessToken token clientType 客户端类型(1: Andriod, 2: iOS, 3: web, 4: h5) outId 外部流水号
/// @param successHandle 成功回调
/// @param failureHandle 失败回调
+ (void)MY_user_loginForOneClick_RequestWithParam:(NSDictionary *)param
                                       successHandle:(void(^)(id response))successHandle
                                       failureHandle:(void(^)(NSError *error))failureHandle{

    [MYHTTPManager  postAFNWithUrl:MY_user_loginForOneClick parameters:param MYServiceModuleType:PublicBaseUrl_Type successHandle:^(NSURLSessionTask * _Nonnull task, id  _Nonnull response) {
        DLog(@"%@",response);

        if ([self requestReslutDelWith:response]) {
            if (successHandle) {
                successHandle(response);
            }
        }
        else
        {
            if (failureHandle) {
                failureHandle(nil);
            }
        }
        
        
    } failureHandle:^(NSURLSessionTask * _Nonnull task, NSError * _Nonnull error) {
        DLog(@"%@",error);

        if (failureHandle) {
            failureHandle(error);
        }
    }];
}
/// 密码登录 MY_user_loginForPassword
/// @param param area 区号 clientType 2iOS mobile 手机号 password 密码
/// @param successHandle 成功回调
/// @param failureHandle 失败回调
+ (void)MY_user_loginForPassword_RequestWithParam:(NSDictionary *)param
                                       successHandle:(void(^)(id response))successHandle
                                       failureHandle:(void(^)(NSError *error))failureHandle{

    [MYHTTPManager  postAFNWithUrl:MY_user_loginForPassword parameters:param MYServiceModuleType:PublicBaseUrl_Type successHandle:^(NSURLSessionTask * _Nonnull task, id  _Nonnull response) {
        DLog(@"%@",response);

        if ([self requestReslutDelWith:response]) {
            if (successHandle) {
                successHandle(response);
            }
        }
        else
        {
            if (failureHandle) {
                failureHandle(nil);
            }
        }
        
        
    } failureHandle:^(NSURLSessionTask * _Nonnull task, NSError * _Nonnull error) {
        DLog(@"%@",error);

        if (failureHandle) {
            failureHandle(error);
        }
    }];
}
/// 短信登录 MY_user_loginForSms
/// @param param area 区号 clientType 2iOS code 验证码 mobile 手机号
/// @param successHandle 成功回调
/// @param failureHandle 失败回调
+ (void)MY_user_loginForSms_RequestWithParam:(NSDictionary *)param
                                       successHandle:(void(^)(id response))successHandle
                                       failureHandle:(void(^)(NSError *error))failureHandle{

    [MYHTTPManager  postAFNWithUrl:MY_user_loginForSms parameters:param MYServiceModuleType:PublicBaseUrl_Type successHandle:^(NSURLSessionTask * _Nonnull task, id  _Nonnull response) {
        DLog(@"%@",response);

        if ([self requestReslutDelWith:response]) {
            if (successHandle) {
                successHandle(response);
            }
        }
        else
        {
            if (failureHandle) {
                failureHandle(nil);
            }
        }
        
        
    } failureHandle:^(NSURLSessionTask * _Nonnull task, NSError * _Nonnull error) {
        DLog(@"%@",error);

        if (failureHandle) {
            failureHandle(error);
        }
    }];
}
/// 第三方登录 MY_user_loginForThirdParty
/// @param param aode 短信验证码 password 密码
/// @param successHandle 成功回调
/// @param failureHandle 失败回调
+ (void)MY_user_loginForThirdParty_RequestWithParam:(NSDictionary *)param
                                       successHandle:(void(^)(id response))successHandle
                                       failureHandle:(void(^)(NSError *error))failureHandle{

    [MYHTTPManager  postAFNWithUrl:MY_user_loginForThirdParty parameters:param MYServiceModuleType:PublicBaseUrl_Type successHandle:^(NSURLSessionTask * _Nonnull task, id  _Nonnull response) {
        DLog(@"%@",response);

        if ([self requestReslutDelWith:response]) {
            if (successHandle) {
                successHandle(response);
            }
        }
        else
        {
            if (failureHandle) {
                failureHandle(nil);
            }
        }
        
        
    } failureHandle:^(NSURLSessionTask * _Nonnull task, NSError * _Nonnull error) {
        DLog(@"%@",error);

        if (failureHandle) {
            failureHandle(error);
        }
    }];
}
/// 注册 MY_user_register
/// @param param area 区号 clientType 2iOS code 验证码 mobile 手机号 password 密码
/// @param successHandle 成功回调
/// @param failureHandle 失败回调
+ (void)MY_user_register_RequestWithParam:(NSDictionary *)param
                                       successHandle:(void(^)(id response))successHandle
                                       failureHandle:(void(^)(NSError *error))failureHandle{

    [MYHTTPManager  postAFNWithUrl:MY_user_register parameters:param MYServiceModuleType:PublicBaseUrl_Type successHandle:^(NSURLSessionTask * _Nonnull task, id  _Nonnull response) {
        DLog(@"%@",response);

        if ([self requestReslutDelWith:response]) {
            if (successHandle) {
                successHandle(response);
            }
        }
        else
        {
            if (failureHandle) {
                failureHandle(nil);
            }
        }
        
        
    } failureHandle:^(NSURLSessionTask * _Nonnull task, NSError * _Nonnull error) {
        DLog(@"%@",error);

        if (failureHandle) {
            failureHandle(error);
        }
    }];
}
/// 重置密码并登录 MY_user_resetPasswordAndLoginRequest
/// @param param clientType 2iOS mobile 手机号 password 密码 token 临时token
/// @param successHandle 成功回调
/// @param failureHandle 失败回调
+ (void)MY_user_resetPasswordAndLoginRequest_RequestWithParam:(NSDictionary *)param
                                       successHandle:(void(^)(id response))successHandle
                                       failureHandle:(void(^)(NSError *error))failureHandle{

    [MYHTTPManager  postAFNWithUrl:MY_user_resetPasswordAndLoginRequest parameters:param MYServiceModuleType:PublicBaseUrl_Type successHandle:^(NSURLSessionTask * _Nonnull task, id  _Nonnull response) {
        DLog(@"%@",response);

        if ([self requestReslutDelWith:response]) {
            if (successHandle) {
                successHandle(response);
            }
        }
        else
        {
            if (failureHandle) {
                failureHandle(nil);
            }
        }
        
        
    } failureHandle:^(NSURLSessionTask * _Nonnull task, NSError * _Nonnull error) {
        DLog(@"%@",error);

        if (failureHandle) {
            failureHandle(error);
        }
    }];
}
/// 发送找回密码验证码 MY_user_sendForgotPasswordCode
/// @param param captcha 图片验证码 mobile 手机号
/// @param successHandle 成功回调
/// @param failureHandle 失败回调
+ (void)MY_user_sendForgotPasswordCode_RequestWithParam:(NSDictionary *)param
                                       successHandle:(void(^)(id response))successHandle
                                       failureHandle:(void(^)(NSError *error))failureHandle{

    [MYHTTPManager  postAFNWithUrl:MY_user_sendForgotPasswordCode parameters:param MYServiceModuleType:PublicBaseUrl_Type successHandle:^(NSURLSessionTask * _Nonnull task, id  _Nonnull response) {
        DLog(@"%@",response);

        if ([self requestReslutDelWith:response]) {
            if (successHandle) {
                successHandle(response);
            }
        }
        else
        {
            if (failureHandle) {
                failureHandle(nil);
            }
        }
        
        
    } failureHandle:^(NSURLSessionTask * _Nonnull task, NSError * _Nonnull error) {
        DLog(@"%@",error);

        if (failureHandle) {
            failureHandle(error);
        }
    }];
}
/// 发送注册验证码 MY_user_sendRegisterCode
/// @param param captcha 图片验证码 mobile 手机号
/// @param successHandle 成功回调
/// @param failureHandle 失败回调
+ (void)MY_user_sendRegisterCode_RequestWithParam:(NSDictionary *)param
                                       successHandle:(void(^)(id response))successHandle
                                       failureHandle:(void(^)(NSError *error))failureHandle{

    [MYHTTPManager  postAFNWithUrl:MY_user_sendRegisterCode parameters:param MYServiceModuleType:PublicBaseUrl_Type successHandle:^(NSURLSessionTask * _Nonnull task, id  _Nonnull response) {
        DLog(@"%@",response);

        if ([self requestReslutDelWith:response]) {
            if (successHandle) {
                successHandle(response);
            }
        }
        else
        {
            if (failureHandle) {
                failureHandle(nil);
            }
        }
        
        
    } failureHandle:^(NSURLSessionTask * _Nonnull task, NSError * _Nonnull error) {
        DLog(@"%@",error);

        if (failureHandle) {
            failureHandle(error);
        }
    }];
}
/// 发送短信登录验证码 MY_user_sendSmsLoginCode
/// @param param captcha 图片验证码 mobile 手机号
/// @param successHandle 成功回调
/// @param failureHandle 失败回调
+ (void)MY_user_sendSmsLoginCode_RequestWithParam:(NSDictionary *)param
                                       successHandle:(void(^)(id response))successHandle
                                       failureHandle:(void(^)(NSError *error))failureHandle{

    [MYHTTPManager  postAFNWithUrl:MY_user_sendSmsLoginCode parameters:param MYServiceModuleType:PublicBaseUrl_Type successHandle:^(NSURLSessionTask * _Nonnull task, id  _Nonnull response) {
        DLog(@"%@",response);

        if ([self requestReslutDelWith:response]) {
            if (successHandle) {
                successHandle(response);
            }
        }
        else
        {
            if (failureHandle) {
                failureHandle(nil);
            }
        }
        
        
    } failureHandle:^(NSURLSessionTask * _Nonnull task, NSError * _Nonnull error) {
        DLog(@"%@",error);

        if (failureHandle) {
            failureHandle(error);
        }
    }];
}
/// 更新用户密码 MY_user_updateUserPassword
/// @param param guid 临时guid password 新密码
/// @param successHandle 成功回调
/// @param failureHandle 失败回调
+ (void)MY_user_updateUserPassword_RequestWithParam:(NSDictionary *)param
                                       successHandle:(void(^)(id response))successHandle
                                       failureHandle:(void(^)(NSError *error))failureHandle{

    [MYHTTPManager  postAFNWithUrl:MY_user_updateUserPassword parameters:param MYServiceModuleType:PublicBaseUrl_Type successHandle:^(NSURLSessionTask * _Nonnull task, id  _Nonnull response) {
        DLog(@"%@",response);

        if ([self requestReslutDelWith:response]) {
            if (successHandle) {
                successHandle(response);
            }
        }
        else
        {
            if (failureHandle) {
                failureHandle(nil);
            }
        }
        
        
    } failureHandle:^(NSURLSessionTask * _Nonnull task, NSError * _Nonnull error) {
        DLog(@"%@",error);

        if (failureHandle) {
            failureHandle(error);
        }
    }];
}
/// 验证找回密码验证码(成功返回临时guid)  MY_user_verifyForgotPasswordCode
/// @param param code 验证码 mobile 手机号码
/// @param successHandle 成功回调
/// @param failureHandle 失败回调
+ (void)MY_user_verifyForgotPasswordCode_RequestWithParam:(NSDictionary *)param
                                       successHandle:(void(^)(id response))successHandle
                                       failureHandle:(void(^)(NSError *error))failureHandle{

    [MYHTTPManager  postAFNWithUrl:MY_user_verifyForgotPasswordCode parameters:param MYServiceModuleType:PublicBaseUrl_Type successHandle:^(NSURLSessionTask * _Nonnull task, id  _Nonnull response) {
        DLog(@"%@",response);

        if ([self requestReslutDelWith:response]) {
            if (successHandle) {
                successHandle(response);
            }
        }
        else
        {
            if (failureHandle) {
                failureHandle(nil);
            }
        }
        
        
    } failureHandle:^(NSURLSessionTask * _Nonnull task, NSError * _Nonnull error) {
        DLog(@"%@",error);

        if (failureHandle) {
            failureHandle(error);
        }
    }];
}
/// 生成图片验证码 MY_user_generateCaptcha
/// @param param clientType 2iOS
/// @param successHandle 成功回调
/// @param failureHandle 失败回调
+ (void)MY_user_generateCaptcha_RequestWithParam:(NSDictionary *)param
                                       successHandle:(void(^)(id response))successHandle
                                       failureHandle:(void(^)(NSError *error))failureHandle{

    [MYHTTPManager  postAFNWithUrl:MY_user_generateCaptcha parameters:param MYServiceModuleType:PublicBaseUrl_Type successHandle:^(NSURLSessionTask * _Nonnull task, id  _Nonnull response) {
        DLog(@"%@",response);

        if ([self requestReslutDelWith:response]) {
            if (successHandle) {
                successHandle(response);
            }
        }
        else
        {
            if (failureHandle) {
                failureHandle(nil);
            }
        }
        
        
    } failureHandle:^(NSURLSessionTask * _Nonnull task, NSError * _Nonnull error) {
        DLog(@"%@",error);

        if (failureHandle) {
            failureHandle(error);
        }
    }];
}
/// 获取当前登录用户资料 MY_user_getUserProfile
/// @param param 无参数
/// @param successHandle 成功回调
/// @param failureHandle 失败回调
+ (void)MY_user_getUserProfile_RequestWithParam:(NSDictionary *)param
                                       successHandle:(void(^)(id response))successHandle
                                       failureHandle:(void(^)(NSError *error))failureHandle{

    [MYHTTPManager  postAFNWithUrl:MY_user_getUserProfile parameters:param MYServiceModuleType:PublicBaseUrl_Type successHandle:^(NSURLSessionTask * _Nonnull task, id  _Nonnull response) {
        DLog(@"%@",response);

        if ([self requestReslutDelWith:response]) {
            if (successHandle) {
                successHandle(response);
            }
        }
        else
        {
            if (failureHandle) {
                failureHandle(nil);
            }
        }
        
        
    } failureHandle:^(NSURLSessionTask * _Nonnull task, NSError * _Nonnull error) {
        DLog(@"%@",error);

        if (failureHandle) {
            failureHandle(error);
        }
    }];
}
/// 初始化腾讯COS  MY_user_tencent_initializeCOS
/// @param param 待定
/// @param successHandle 成功回调
/// @param failureHandle 失败回调
+ (void)MY_user_tencent_initializeCOS_RequestWithParam:(NSDictionary *)param
                                       successHandle:(void(^)(id response))successHandle
                                       failureHandle:(void(^)(NSError *error))failureHandle{

    [MYHTTPManager  postAFNWithUrl:MY_user_tencent_initializeCOS parameters:param MYServiceModuleType:PublicBaseUrl_Type successHandle:^(NSURLSessionTask * _Nonnull task, id  _Nonnull response) {
        DLog(@"%@",response);

        if ([self requestReslutDelWith:response]) {
            if (successHandle) {
                successHandle(response);
            }
        }
        else
        {
            if (failureHandle) {
                failureHandle(nil);
            }
        }
        
        
    } failureHandle:^(NSURLSessionTask * _Nonnull task, NSError * _Nonnull error) {
        DLog(@"%@",error);

        if (failureHandle) {
            failureHandle(error);
        }
    }];
}
/// 获取登录im信息 MY_user_getLoginIMInfo
/// @param param 无参数
/// @param successHandle 成功回调
/// @param failureHandle 失败回调
+ (void)MY_user_getLoginIMInfo_RequestWithParam:(NSDictionary *)param
                                       successHandle:(void(^)(id response))successHandle
                                       failureHandle:(void(^)(NSError *error))failureHandle{

    [MYHTTPManager  postAFNWithUrl:MY_user_getLoginIMInfo parameters:param MYServiceModuleType:PublicBaseUrl_Type successHandle:^(NSURLSessionTask * _Nonnull task, id  _Nonnull response) {
        DLog(@"%@",response);

        if ([self requestReslutDelWith:response]) {
            if (successHandle) {
                successHandle(response);
            }
        }
        else
        {
            if (failureHandle) {
                failureHandle(nil);
            }
        }
        
        
    } failureHandle:^(NSURLSessionTask * _Nonnull task, NSError * _Nonnull error) {
        DLog(@"%@",error);

        if (failureHandle) {
            failureHandle(error);
        }
    }];
}
/// 根据类型获取社交分享内容 MY_user_socialshare_get
/// @param param socialShareEnum 社交分享类型(1:app个人中心分享)
/// @param successHandle 成功回调
/// @param failureHandle 失败回调
+ (void)MY_user_socialshare_get_RequestWithParam:(NSDictionary *)param
                                       successHandle:(void(^)(id response))successHandle
                                       failureHandle:(void(^)(NSError *error))failureHandle{

    [MYHTTPManager  postAFNWithUrl:MY_user_socialshare_get parameters:param MYServiceModuleType:PublicBaseUrl_Type successHandle:^(NSURLSessionTask * _Nonnull task, id  _Nonnull response) {
        DLog(@"%@",response);

        if ([self requestReslutDelWith:response]) {
            if (successHandle) {
                successHandle(response);
            }
        }
        else
        {
            if (failureHandle) {
                failureHandle(nil);
            }
        }
        
        
    } failureHandle:^(NSURLSessionTask * _Nonnull task, NSError * _Nonnull error) {
        DLog(@"%@",error);

        if (failureHandle) {
            failureHandle(error);
        }
    }];
}
/// 保存社交分享内容 MY_user_socialshare_save
/// @param param socialShareEnum 社交分享类型(1:app个人中心分享) title 标题 description 描述 imageUrl 图片Url url 跳转链接 imageFile 图片文件
/// @param successHandle 成功回调
/// @param failureHandle 失败回调
+ (void)MY_user_socialshare_save_RequestWithParam:(NSDictionary *)param
                                       successHandle:(void(^)(id response))successHandle
                                       failureHandle:(void(^)(NSError *error))failureHandle{

    [MYHTTPManager  postAFNWithUrl:MY_user_socialshare_save parameters:param MYServiceModuleType:PublicBaseUrl_Type successHandle:^(NSURLSessionTask * _Nonnull task, id  _Nonnull response) {
        DLog(@"%@",response);

        if ([self requestReslutDelWith:response]) {
            if (successHandle) {
                successHandle(response);
            }
        }
        else
        {
            if (failureHandle) {
                failureHandle(nil);
            }
        }
        
        
    } failureHandle:^(NSURLSessionTask * _Nonnull task, NSError * _Nonnull error) {
        DLog(@"%@",error);

        if (failureHandle) {
            failureHandle(error);
        }
    }];
}
/// 更新用户信息(使用multipart/form-data协议,头像和数据一起上传,成功返回图片的url)  MY_user_updateUserInfo
/// @param param nickname 用户昵称 birthday 用户生日(格式:yyyy-MM-dd) signature 个性签名 avatarFile 头像文件 gender 性别(0:未定 1:男 2:女)
/// @param successHandle 成功回调
/// @param failureHandle 失败回调
+ (void)MY_user_updateUserInfo_RequestWithParam:(NSDictionary *)param
                                       successHandle:(void(^)(id response))successHandle
                                       failureHandle:(void(^)(NSError *error))failureHandle{

    [MYHTTPManager  postAFNWithUrl:MY_user_updateUserInfo parameters:param MYServiceModuleType:PublicBaseUrl_Type successHandle:^(NSURLSessionTask * _Nonnull task, id  _Nonnull response) {
        DLog(@"%@",response);

        if ([self requestReslutDelWith:response]) {
            if (successHandle) {
                successHandle(response);
            }
        }
        else
        {
            if (failureHandle) {
                failureHandle(nil);
            }
        }
        
        
    } failureHandle:^(NSURLSessionTask * _Nonnull task, NSError * _Nonnull error) {
        DLog(@"%@",error);

        if (failureHandle) {
            failureHandle(error);
        }
    }];
}
/// 发送修改密码验证码 MY_user_sendUpdatePasswordCode
/// @param param captcha 图片验证码
/// @param successHandle 成功回调
/// @param failureHandle 失败回调
+ (void)MY_user_sendUpdatePasswordCode_RequestWithParam:(NSDictionary *)param
                                       successHandle:(void(^)(id response))successHandle
                                       failureHandle:(void(^)(NSError *error))failureHandle{

    [MYHTTPManager  postAFNWithUrl:MY_user_sendUpdatePasswordCode parameters:param MYServiceModuleType:PublicBaseUrl_Type successHandle:^(NSURLSessionTask * _Nonnull task, id  _Nonnull response) {
        DLog(@"%@",response);

        if ([self requestReslutDelWith:response]) {
            if (successHandle) {
                successHandle(response);
            }
        }
        else
        {
            if (failureHandle) {
                failureHandle(nil);
            }
        }
        
        
    } failureHandle:^(NSURLSessionTask * _Nonnull task, NSError * _Nonnull error) {
        DLog(@"%@",error);

        if (failureHandle) {
            failureHandle(error);
        }
    }];
}
/// 验证修改密码验证码(成功返回临时guid) MY_user_verifyUpdatePasswordCode
/// @param param code 验证码
/// @param successHandle 成功回调
/// @param failureHandle 失败回调
+ (void)MY_user_verifyUpdatePasswordCode_RequestWithParam:(NSDictionary *)param
                                       successHandle:(void(^)(id response))successHandle
                                       failureHandle:(void(^)(NSError *error))failureHandle{

    [MYHTTPManager  postAFNWithUrl:MY_user_verifyUpdatePasswordCode parameters:param MYServiceModuleType:PublicBaseUrl_Type successHandle:^(NSURLSessionTask * _Nonnull task, id  _Nonnull response) {
        DLog(@"%@",response);

        if ([self requestReslutDelWith:response]) {
            if (successHandle) {
                successHandle(response);
            }
        }
        else
        {
            if (failureHandle) {
                failureHandle(nil);
            }
        }
        
        
    } failureHandle:^(NSURLSessionTask * _Nonnull task, NSError * _Nonnull error) {
        DLog(@"%@",error);

        if (failureHandle) {
            failureHandle(error);
        }
    }];
}


@end
